package by.airlanterns.service;

import by.airlanterns.dao.OrderDaoImpl;
import by.airlanterns.dto.UserOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: Sergey
 * Date: 31.01.13
 * Time: 9:01
 * To change this template use File | Settings | File Templates.
 */
@Service
public class OrderService {

    @Autowired
    private OrderDaoImpl orderDao;

    public void saveOrder(UserOrder userOrder) {
        orderDao.save(userOrder);
    }

    public void saveOrUpdateOrder(UserOrder userOrder) {
        orderDao.saveOrUpdate(userOrder);
    }

    public List<UserOrder> findAllOrders() {
        return orderDao.findAll();
    }

    public UserOrder findOrderById(int id) {
        return orderDao.findById(id);
    }

    public List<UserOrder> getOrdersByUser(int uId) {
        return orderDao.getOrdersByUser(uId);
    }

}
